home *** CD-ROM | disk | FTP | other *** search
/ Apple Service Source 1996 February / Service Source 2.0 1996 Companion.iso / AppleOrder / Program / AppleOrder CCL Folder / Hayes V.42.CCL < prev    next >
Encoding:
Text File  |  1992-09-18  |  21.4 KB  |  666 lines  |  [TEXT/MPS ]

  1. !
  2. ! Hayes V.42 SmartModem 9600 CCL script (Hardware MNP)
  3. !
  4. !    Change History-
  5. !        v1.0.1ß1    11/19/90    gs:Created CCL
  6. !        v1.0.2        12/07/90    gs:Added bug fix for Printer Port ~MPRT selection
  7. !                    1/08/91        gs:Attempt V.42 connection LAPM/MNP using error
  8. !                                controlled link else dont connect.
  9. !                    1/22/91        gs:Set &K4 to use XON/XOFF flow control
  10. !
  11. !    The following label ranges (0-255) are defined for all scripts:
  12. !
  13. !    Label        Function
  14. !    -----        --------
  15. !    0-19        Communications Setup
  16. !    20-39        Get a Modem (IBX switch thru)
  17. !    40-59        Modem Setup
  18. !    60-79        Dialing
  19. !    80-99        Physical Connection
  20. !    100-119        GEIS Logon
  21. !    120-139        CICS
  22. !    140-159        APPM
  23. !    160-179        Online
  24. !    180-199        Terminate Session
  25. !    200-209        Cancel
  26. !    210-219        Hangup
  27. !    230-239        <UNUSED>
  28. !    240-255        Disconnect
  29. !
  30. !    Note:        Label 210 is the modem hangup sequence
  31. !                Label 240 is reserved as the start of the disconnect sequence
  32. !
  33. !================================================================================
  34. -LABEL 0    !***<Physical connection entry point>*** Initialize Communications
  35. !================================================================================
  36. !
  37. !    Set the Baud, Data, Stop, and Parity bits
  38. SerReset ~Baud ~Prty ~Xbts ~Sbts
  39. CTBParameter Port "~MPrt" 13
  40. !
  41. !    CTBOPEN [<LabelIfOpenFails>] [<LabelIfError>]
  42. CTBOpen 14 15        ! Open the Communications session
  43. !
  44. !    Flush any data, Initialize script variables and define Cancel label
  45. Flush                ! clear input buffer and ring buffer
  46. CanBtn 200            ! If user cancels, take the error return
  47. !
  48. SetVar 1 0            ! #of consecutive no responses to hangup command
  49. SetVar 2 0            ! #of consecutive no responses to modem configuration command
  50. SetVar 3 0            ! #of consecutive network contact failures.
  51. SetVar 4 0            ! #of logon validation failures
  52. SetVar 5 0            ! #of consecutive CICS90  failures
  53. SetVar 6 0            ! #of consecutive APPM failures
  54. SetVar 7 0            ! flag to indicate if connecting(0) or disconnecting(1)
  55. SetVar 8 0            ! not used
  56. !
  57. Jump 20                ! Go to Modem Selection and Setup
  58. !
  59. !*********
  60. -LABEL 13    !---<CTBParameter Port failed>---
  61. !*********
  62. Alert -1 CTBParameter Port caused an error.
  63. Exit -1                ! exit the script with an error.
  64. !
  65. !*********
  66. -LABEL 14    !---<CTBOpen failed>---
  67. !*********
  68. Alert -1 CTBOpen could not open communications.\13The serial port may already be in use.
  69. Exit -1                ! exit the script with an error.
  70. !
  71. !**********
  72. -LABEL 15    !---<CTBOpen err>---
  73. !**********
  74. Alert -1 CTBOpen caused an Communications Toolbox error.
  75. Exit -1                ! exit the script with an error.
  76. !
  77. !================================================================================
  78. -LABEL 20    !***<Modem Selection>*** Select modem through IBX switch
  79. !================================================================================
  80. !
  81. !================================================================================
  82. -LABEL 40    !***<Modem Setup>*** Modem Reset and Setup
  83. !================================================================================
  84. DsplyPic 1
  85. DsplyMsg Making sure the modem is ready.
  86. Jsr 210                ! Hang up (just in case)
  87. SetVar 1 0            ! clear # hangup tries counter
  88. !
  89. !**********
  90. -LABEL 42    ! ---<Got modem attention>---
  91. !**********
  92. DsplyMsg Setting modem parameters.
  93. !    Clear all previous MatchStr's and setup the modem
  94. MatchStr 1 42 Dummy
  95. Wait 30                ! Give modem .5 second to get ready before sending the attention chars
  96. Xmit AT
  97. !    Send MNP Compatible modem commands
  98. Wait 3                ! Pause before "verbal result messages" command
  99. Xmit V1
  100. Wait 3                ! Pause before selecting Error Control transmission mode
  101. Xmit &Q5
  102. Wait 3                ! Pause before Enable Negotiation progress reporting
  103. Xmit W1
  104. Wait 3                ! Pause before specifying error controlled link V.42 LAPM/MNP connection
  105. Xmit S48=128
  106. Xmit S36=4
  107. Wait 3                ! Use XON/XOFF flow control since cable might not have RTS/CTS pins
  108. Xmit &K4
  109. Flush                ! clear input buffer and send Carriage Return (CR)
  110. Xmit \13
  111. !
  112. !    Look for one of the following expected responses
  113. MatchStr 1 60 OK
  114. Wait 180               ! wait 3 secs
  115. IncVar 2            ! increment # modem setup tries
  116. IfVar 2 3 44        ! if 3 tries, display Modem Configuration Alert
  117. DsplyMsg Modem does not respond to setup commands. Retrying ...
  118. Jump 42                ! else try modem setup again
  119. !
  120. !**********
  121. -LABEL 44    ! ---<Modem configuration err>---
  122. !**********
  123. Bell
  124. Alert 200 The modem is not responding to setup commands.\13Turn the modem off and then on again before retrying.
  125. SetVar 2 0            ! clear # modem setup tries
  126. Jump 40                ! reset modem and try again
  127. !
  128. !================================================================================
  129. -LABEL 60    !***<Modem ready>*** Dial phone
  130. !================================================================================
  131. DsplyMsg Dialing ~Fone ...
  132. DsplyPic 2
  133. !    Clear all previous MatchStr's (No comments on same line as MatchStr's)
  134. MatchStr 1 60 Dummy
  135. SetVar 2 0            ! clear #modem setup tries
  136. !    Turn off Xon/Xoff flow control
  137. CTBParameter Handshake XON/XOFF 78
  138. Wait 30                ! Give modem .5 secs to get ready before sending the attention chars
  139. Xmit AT
  140. Wait 3                ! Pause before "tone dial" command
  141. Xmit D~Tone
  142. Wait 3                ! Pause before phone number
  143. Xmit ~Fone
  144. Wait 3
  145. Flush                ! clear input buffer and send CR
  146. Xmit \13
  147. !
  148. !    Look for one of the following expected responses
  149. MatchStr 1 80 CONNECT ~Baud
  150. MatchStr 2 66 NO CARRIER
  151. MatchStr 3 70 BUSY
  152. MatchStr 4 74 NO DIAL
  153. MatchStr 5 62 ERROR
  154. Wait 2100            ! wait 35 secs
  155. !
  156. !**********
  157. -LABEL 62    !---<No response or ERROR from modem>---
  158. !**********
  159. IncVar 3            ! Increment # dial attempts counter
  160. IfVar 3 4 64        ! if 4 attempts, display No Dial Response Alert
  161. DsplyMsg Modem does not respond to Dial command. Retrying ...
  162. Jump 40                ! reset modem and try again
  163. !
  164. !**********
  165. -LABEL 64    !---<No dial response err>---
  166. !**********
  167. Bell
  168. Alert 200 The modem is not responding to dial command.\13Make sure your modem is connected to a phone line.
  169. SetVar 3 0            ! clear # dial attempts counter
  170. Jump 40                ! reset modem and try again
  171. !
  172. !**********
  173. -LABEL 66   !---<No Carrier>---
  174. !**********
  175. IncVar 3            ! Increment # dial attempts counter
  176. IfVar 3 4 68        ! if 4 attempts, display No Carrier Alert
  177. DsplyMsg No Carrier with phone number dialed. Retrying ...
  178. Jump 40                ! reset modem and try again
  179. !
  180. !**********
  181. -LABEL 68    !---<No carrier err>---
  182. !**********
  183. Bell
  184. Alert 200 Cannot detect carrier signal after dialing.\13Make sure the phone number provided is correct.
  185. SetVar 3 0            ! clear # dial attempts counter
  186. Jump 40                ! reset modem and try again
  187. !
  188. !**********
  189. -LABEL 70    !---<busy>---
  190. !**********
  191. IncVar 3            ! Increment # dial attempts counter
  192. IfVar 3 4 72        ! if 4 attempts, display Busy Alert
  193. DsplyMsg Phone number dialed is busy. Pause  before retrying.
  194. Wait 300            ! wait 5 secs
  195. DsplyMsg Phone number dialed is busy. Retrying ....
  196. Jump 40                ! reset modem and try again
  197. !
  198. !**********
  199. -LABEL 72    !---<Busy err>---
  200. !**********
  201. Bell
  202. Alert 200 All network access lines are in use.\13Try again later.
  203. SetVar 3 0            ! clear # dial attempts counter
  204. Jump 40                ! reset modem and try again
  205. !
  206. !**********
  207. -LABEL 74    !---<No Dialtone>---
  208. !**********
  209. IncVar 3            ! Increment # dial attempts counter
  210. IfVar 3 4 76        ! if 4 attempts, display No Dialtone Alert
  211. DsplyMsg Modem reports no dial tone. Retrying ...
  212. Jump 40                ! reset modem and try again
  213. !
  214. !**********
  215. -LABEL 76   !---<No dialtone Error>---
  216. !**********
  217. Bell
  218. Alert 200 Modem reports no dial tone.\13Make sure your modem is connected to a phone line.
  219. SetVar 3 0            ! clear # dial attempts counter
  220. Jump 40                ! reset modem and try again
  221. !
  222. !*********
  223. -LABEL 78    !---<CTBParameter XON/XOFF failed>---
  224. !*********
  225. Alert -1 CTBParameter XON/XOFF caused an error.
  226. Exit -1                ! exit the script with an error
  227. !
  228. !================================================================================
  229. -LABEL 80    !***<Establish Physical Connection>*** Send H's to identify us to network
  230. !================================================================================
  231. DsplyMsg Requesting network attention
  232. !    Look for one of the following expected responses
  233. MatchStr 1 84 NO CARRIER
  234. MatchStr 2 100 U#
  235. Wait 12                ! Wait 0.2 sec before sending the first H
  236. Xmit H
  237. Wait 21                ! Wait another 0.35 sec before sending the second H
  238. Xmit H
  239. Wait 600            ! Allow 10 seconds for the U# to show up
  240. IncVar 3            ! No U#, increment # dial attempts counter
  241. IfVar 3 4 82        ! if 4 attempts, display No U# Alert
  242. DsplyMsg Unable to get network attention. Retrying ...
  243. Jump 40                ! reset modem and try again
  244. !
  245. !**********
  246. -LABEL 82    !---<No U#>---
  247. !**********
  248. Bell
  249. Alert 200 Unable to get the network's attention.\13Make sure you have the correct phone number.
  250. SetVar 3 0            ! clear # dial attempts counter
  251. Jump 40                ! reset modem and try again
  252. !
  253. !**********
  254. -LABEL 84    !---<Line dropped>---
  255. !**********
  256. IncVar 3            ! Increment # dial attempts counter
  257. IfVar 3 4 86        ! if 4 attempts, display Line Dropped Alert
  258. DsplyMsg Carrier signal dropped before network recognition. Retrying ...
  259. Jump 40                ! reset modem and try again
  260. !
  261. !**********
  262. -LABEL 86   !---<Line dropped Err>---
  263. !**********
  264. Bell
  265. Alert 200 Carrier signal dropped before network recognition.\13Try again.
  266. SetVar 3 0            ! clear # dial attempts counter
  267. Jump 40                ! reset modem and try again
  268. !
  269. !================================================================================
  270. -LABEL 100    !***<GEIS logon>***
  271. !================================================================================
  272. !
  273. DsplyMsg Physical Connection established. Logging on to network ...
  274. DsplyPic 3
  275. SetVar 3 0            ! clear # dial attempts counter
  276. Wait 6                ! wait 0.1 sec
  277. Flush                ! clear input buffer
  278. !    Note: leave 2 spaces between ~Dist and ~Numb
  279. Xmit ~User,~Dist  ~Numb,~Ridn\13
  280. !
  281. !    Look for one of the following expected responses
  282. MatchStr 1 104 NO CARRIER
  283. MatchStr 2 106 DISCONNECTED
  284. MatchStr 3 120 ===>
  285. MatchStr 4 114 UNAVAIL
  286. !    MatchStr 5 ??? INTERRUPT
  287. MatchStr 6 108 N FAULT,
  288. MatchStr 7 108 T FORMAT,
  289. MatchStr 8 110 L DENIED
  290. MatchStr 9 112 BUSY
  291. MatchStr 10 112 DOWN
  292. Wait 4200            ! wait up to 70 seconds for a response
  293. IncVar 4            ! Increment # logon attempts counter
  294. IfVar 4 3 102        ! if 3 tries, display No Login Response alert 
  295. DsplyMsg No logon response from network. Retrying ...
  296. Jump 40                ! reset modem and try again
  297. !
  298. !*********
  299. -LABEL 102    !---<No Logon response>---
  300. !*********
  301. Bell
  302. Alert 200 No logon response from network.\13Try again.
  303. SetVar 4 0            ! clear # logon attempts counter
  304. Jump 40                ! reset modem and try again
  305. !
  306. !*********
  307. -LABEL 104    !---<Carrier dropped>---
  308. !*********
  309. IncVar 4            ! Increment # login attempts counter
  310. IfVar 4 3 105        ! if 3 attempts, display Carrier dropped alert
  311. DsplyMsg Carrier signal dropped during network logon. Retrying ...
  312. Jump 40                ! reset modem and try again
  313. !
  314. !*********
  315. -LABEL 105    !---<Carrier dropped Err>---
  316. !*********
  317. Bell
  318. Alert 200 Carrier signal dropped during network logon.\13Try again.
  319. SetVar 4 0            ! clear # logon attempts counter
  320. Jump 40                ! reset modem and try again
  321. !
  322. !*********
  323. -LABEL 106    !---<Session disconnected>---
  324. !*********
  325. IncVar 4            ! Increment # logon attempts counter
  326. IfVar 4 3 107        ! if 3 attempts, display Session disconnected alert
  327. DsplyMsg Network connection dropped during network logon. Retrying ...
  328. Jump 40                ! reset modem and try again
  329. !
  330. !*********
  331. -LABEL 107    !---<Session disconnected Err>---
  332. !*********
  333. Bell
  334. Alert 200 Network connection dropped during network logon.\13Try again.
  335. SetVar 4 0            ! clear # logon attempts counter
  336. Jump 40                ! reset modem and try again
  337. !
  338. !*********
  339. -LABEL 108    !---<Validation fault>---
  340. !*********
  341. IncVar 4            ! Increment # logon attempts counter
  342. IfVar 4 3 109        ! see if limit of 3 is exceeded.
  343. DsplyMsg Network rejected your identification. Retrying ...
  344. Wait 60                ! wait 1 sec
  345. Jump 100            ! retry GEIS login (only case where we don't reset)
  346. !
  347. !*********
  348. -LABEL 109    !---<validation fault err>---
  349. !*********
  350. Bell
  351. Alert 200 Your network identification has been rejected.\13Check Setup to make sure your identification is correct.
  352. SetVar 4 0            ! clear # logon attempts counter
  353. Jump 40                ! reset modem and try again
  354. !
  355. !*********
  356. -LABEL 110    !---<Denied by host>---
  357. !*********
  358. IncVar 4            ! Increment # logon attempts counter
  359. IfVar 4 3 111        ! if 3 attempts, display Network Problem alert
  360. DsplyMsg Network host equipment problem detected. Retrying ...
  361. Jump 40                ! reset modem and try again
  362. !
  363. !*********
  364. -LABEL 111    !---<Denied by host err>---
  365. !*********
  366. Bell
  367. Alert 200 Network host equipment problem detected.\13Try again.
  368. SetVar 4 0            ! clear # logon attempts counter
  369. Jump 40                ! reset modem and try again
  370. !
  371. !*********
  372. -LABEL 112    !---<MARK3K access busy/down>---
  373. !*********
  374. IncVar 4            ! Increment # logon attempts counter
  375. IfVar 4 3 113        ! if 3 attempts, display Network Busy alert
  376. DsplyMsg Network equipment busy/down. Retrying ...
  377. Jump 40                ! reset modem and try again
  378. !
  379. !*********
  380. -LABEL 113    !---<MARK3K access busy/down err>---
  381. !*********
  382. Bell
  383. Alert 200 Network equipment busy or down.\13Try again.
  384. SetVar 4 0            ! clear # logon attempts counter
  385. Jump 40                ! reset modem and try again
  386. !
  387. !*********
  388. -LABEL 114    !---<Network unavailable>---
  389. !*********
  390. IncVar 4            ! Increment # logon attempts counter
  391. IfVar 4 3 115        ! if 3 attempts, display Network Unavailable alert
  392. DsplyMsg Network unavailable message received. Retrying ...
  393. Jump 40                ! reset modem and try again
  394. !
  395. !*********
  396. -LABEL 115    !===<Network unavailable err>===
  397. !*********
  398. Bell
  399. Alert 200 The network is not available at the moment.\13If the problem continues, contact the Apple USA helpline.
  400. SetVar 4 0            ! clear # logon attempts counter
  401. Jump 40                ! reset modem and try again
  402. !
  403. !================================================================================
  404. -LABEL 120    !***<MARK3000 prompt>*** Invoke CICS
  405. !================================================================================
  406. !
  407. DsplyMsg Requesting access to network subsystem ...
  408. DsplyPic 4
  409. Wait 6                ! wait 0.1 secs
  410. Flush                ! clear input buffer
  411. !
  412. Xmit ~CICS\13
  413. !    Look for one of the following expected responses
  414. MatchStr 3 140 READY
  415. !    To overcome a network problem, the following label was changed from 124 to 126
  416. !    MatchStr 4 124 T BOUND
  417. MatchStr 4 126 T BOUND
  418. MatchStr 5 126 UNRECOGN
  419. MatchStr 6 126 ===>
  420. Wait 3600            ! Allow 60 secs for the expected responses to show up
  421. IncVar 5            ! Timeout, so increment # CICS tries counter
  422. IfVar 5 2 122        ! if 3 tries, display No Response alert
  423. DsplyMsg No response to network subsystem request. Retrying ...
  424. Jump 40                ! reset modem and try again
  425. !
  426. !*********
  427. -LABEL 122    !---<No CICS err>---
  428. !*********
  429. Bell
  430. Alert 200 No response to network subsystem request.\13Try again.
  431. SetVar 5 0            ! clear # CICS tries counter
  432. Jump 40                ! reset modem and try again
  433. !
  434. !*********
  435. -LABEL 124    !---<Session not bound err>---
  436. !*********
  437. Bell
  438. Alert 200 Network CICS subsystem needs to be started.\13Please contact the Apple USA helpline immediately.
  439. Jump 200            ! jump to cancel routine
  440. !
  441. !*********
  442. -LABEL 126    !---<Invalid application>---
  443. !*********
  444. IncVar 5            ! Increment # CICS tries counter
  445. IfVar 5 3 127        ! if 3 tries, display Invalid Application alert
  446. DsplyMsg Network subsystem request has been rejected. Retrying ...
  447. Wait 60                ! wait 1 sec
  448. Flush
  449. Jump 120            ! try to access CICS again
  450. !
  451. !*********
  452. -LABEL 127    !---<Invalid application err>---
  453. !*********
  454. Bell
  455. Alert 200 The network subsystem request has been rejected.\13Try again.
  456. SetVar 5 0            ! clear # CICS tries counter
  457. Flush
  458. Jump 40                ! reset modem and try again
  459. !
  460. !================================================================================
  461. -LABEL 140    !***<CICS ready>*** Start APPM transaction
  462. !================================================================================
  463. !
  464. DsplyMsg Requesting access to distribution center ~Dist ...
  465. DsplyPic 5            ! Highlight box 5 on screen
  466. SetVar 5 0            ! clear # CICS tries counter
  467. !                    ! Send what needs to be sent
  468. Xmit ~Epgm~Dist\13
  469. !    Look for one of the following expected responses
  470. Wait 12                ! wait 0.2 secs
  471. Flush                ! clear input buffer
  472. !    Look for one of the following expected responses
  473. MatchStr 3 160 C100
  474. MatchStr 4 144 INVALID
  475. Wait 3600            ! Allow 60 secs for the expected responses to show up
  476. !
  477. IncVar 6            ! Timeout, so Increment # APPM tries counter
  478. IfVar 6 2 142        ! if 2 tries, display No Transaction alert
  479. DsplyMsg No response to distribution center access request. Retrying ...
  480. Jump 40                ! reset modem and try again
  481. !
  482. !*********
  483. -LABEL 142    !---<No transaction response>---
  484. !*********
  485. Bell
  486. Alert 200 No response to distribution center access.\13Try again.
  487. SetVar 6 0            ! reset # APPM tries counter
  488. Jump 40                ! reset modem and try again
  489. !
  490. !*********
  491. -LABEL 144    !---<Invalid transaction>---
  492. !*********
  493. IncVar 6            ! Increment # APPM tries counter
  494. IfVar 6 2 145        ! if 2 tries, display Invalid Transaction alert
  495. DsplyMsg Distribution center access request rejected. Retrying ...
  496. Jump 40                ! reset modem and try again
  497. !
  498. !*********
  499. -LABEL 145    !---<Invalid transaction err>---
  500. !*********
  501. Bell
  502. Alert 200 Distribution center access request rejected.\13Check Setup to make sure your identification is correct.
  503. SetVar 6 0            ! reset # APPM tries counter
  504. Jump 40                ! reset modem and try again
  505. !
  506. !================================================================================
  507. -LABEL 160    !***<Online>***
  508. !================================================================================
  509. !
  510. Wait 60                ! wait 1 sec
  511. DsplyMsg Accessing the distribution center ~Dist ...
  512. DsplyPic 6            ! Highlight box 6 on screen
  513. !    C9 = pass msg thru GE, 899 = Echo cmd
  514. Xmit C9899Ole\13
  515. !    Look for one of the following expected responses
  516. MatchStr 2 162 C5
  517. MatchStr 3 170 Ole\13
  518. Wait 7200            ! wait 2 minutes for echo back or distribution center nonavail msg
  519. !
  520. !*********
  521. -LABEL 162    !---<no luck this time>--- 
  522. !*********
  523. DsplyMsg Distribution center is not available ...
  524. Jsr 180                ! terminate session
  525. Bell
  526. Alert -1 Distribution center is not available.\13Please try again later.
  527. Jump 200            ! exit to Cancel routine
  528. !
  529. !*********
  530. -LABEL 170    !---<Success, we’re in, so exit>--- 
  531. !*********
  532. Wait 30                ! wait 0.5 secs
  533. Flush                ! clear input buffer
  534. Exit 0                ! exit the script normally
  535. !
  536. !================================================================================
  537. -LABEL 180-199    !***<Terminate Session>***
  538. !================================================================================
  539. !
  540. !*********
  541. -LABEL 180    !---<Terminate session>--- 
  542. !*********
  543. !    send Abnormal disconnect command
  544. Xmit C3\13
  545. !    Look for one of the following expected responses
  546. MatchStr 1 182 U#
  547. Wait 300            ! wait 5 secs
  548. Return
  549. !
  550. !*********
  551. -LABEL 182    !---<Say bye>---
  552. !*********
  553. Wait 6                ! wait 0.1 sec and sign off the network
  554. Xmit BYE\13
  555. Return
  556. !
  557. !================================================================================
  558. -LABEL 200    !***<Cancel Routine>***
  559. !================================================================================
  560. DsplyMsg Canceling ...
  561. Flush
  562. Wait 30                ! wait 0.5 secs
  563. Exit -1                ! exit the script with an error
  564. !
  565. !================================================================================
  566. -LABEL 210    !***<Hang up phone Routine>***
  567. !================================================================================
  568. !
  569. !    Look for one of the following expected responses
  570. MatchStr 1 222 CARRIER
  571. SetVar 1 0            ! clear # hangup tries counter
  572. SetVar 2 0            ! clear # modem config tries counter and reuse for MNPStatus checks
  573. !
  574. !*********
  575. -LABEL 220    !---<Hang up the phone subroutine>---
  576. !*********
  577. Wait 60                ! wait 1 sec (beginning guard time) and send +++ (escape)
  578. Xmit +
  579. Xmit +
  580. Xmit +
  581. Wait 60                ! wait 1 more sec (end guard time)
  582. Flush                ! clear input buffer and tell modem to hang up verbosely
  583. Xmit ATV1H\13
  584. !    Look for one of the following expected responses
  585. MatchStr 2 222 OK
  586. MatchStr 3 224 ERROR
  587. Wait 120            ! wait 2 secs
  588. Jump 224            ! test for error or no response            
  589. !
  590. !*********
  591. -LABEL 222    !---<Reset the modem>---
  592. !*********
  593. !
  594. IfVar 7 0 229        ! If NOT disconnecting, bypass the modem reset.
  595. !                      This aids in script debugging so we dont reset modem 1st time.
  596. Flush                ! Flush the buffer and send Hayes Reset Modem command
  597. Xmit ATZ\13
  598. !    Look for one of the following expected responses
  599. MatchStr 2 229 OK
  600. MatchStr 3 224 ERROR
  601. Wait 180            ! wait 3 secs
  602. !
  603. !*********
  604. -LABEL 224    !---<Error or just no response>---
  605. !*********
  606. IncVar 1            ! Increment # hangup tries counter
  607. IfVar 1 3 225        ! if 3 tries, display error alert and try again
  608. Jump 220            ! try to hangup again
  609. !
  610. !*********
  611. -LABEL 225    !---<Error>---
  612. !*********
  613. IfVar 7 1 229        ! If disconnecting, just return.
  614. Alert 200 The modem is not responding to the hangup command.\13Turn it off and then on again before retrying.
  615. SetVar 1 0            ! clear # hangup tries counter
  616. Jump 220            ! try to hangup again
  617. !
  618. !*********
  619. -LABEL 229    !---<Return from the Hangup sequence>---
  620. !*********
  621. Wait 60                ! wait 1 sec
  622. Flush                ! clear input buffer
  623. Return
  624. !
  625. !================================================================================
  626. -LABEL 230-239    !***<UNUSED>***
  627. !================================================================================
  628. !
  629. !================================================================================
  630. -LABEL 240    !***<Disconnection Sequence>***
  631. !================================================================================
  632. !
  633. !    If the connection is closed, we cant hangup, so just exit
  634. !    CTBIFCLOSED <LabelToGotoIfConnectionClosed>
  635. CTBIFCLOSED 246
  636. !
  637. SetVar 7 1            ! We're disconnecting, so set the flag
  638. !    Look for one of the following expected responses
  639. MatchStr 1 242 U#
  640. MatchStr 2 244 NO CARRIER
  641. Wait 60                ! wait 1 sec
  642. Jump 244            ! and hang up the phone
  643. !
  644. !*********
  645. -LABEL 242    !---<Sign off the network>---
  646. !*********
  647. Xmit BYE\13
  648. Wait 120            ! wait 2 secs
  649. !
  650. !*********
  651. -LABEL 244    !---<Hang up the phone>---
  652. !*********
  653. SetVar 1 0            ! clear the # hangup tries counter
  654. Jsr 210                ! Execute the Hang-up subroutine
  655. !    No CTBClose here because the connection is closed externally from the script
  656. !    in case we exited the script with an error before completion.
  657. Flush                ! clear input buffer
  658. Exit 0                ! exit the script normally
  659. !
  660. !*********
  661. -LABEL 246    !---<Connection Was Closed>---
  662. !*********
  663. Flush                ! clear input buffer
  664. Exit 0                ! exit the script normally
  665. ###
  666.